package com.eduran.tuts.jfundamentals.model;

/**
 * Created by eduran on 16.10.2014.
 */
public class Scope {
    private static int x = 1;

    public static void main(String[] args) {
        int x = 5;
        System.out.printf("local x in main is %d%n", x);
        useLocalVariable();
        useField();
        useLocalVariable();
        useField();
        System.out.printf("%nlocal x in main is %d%n", x);

    }

    private static void useLocalVariable() {
        int x = 25;
        System.out.printf("%nlocal x on entering method useLocalVariable is %d", x);
        System.out.printf("%nlocal x before exiting method useField is %d%n", ++x);
    }

    private static void useField() {
        System.out.printf("%nfield x on entering method useField is %d%n", x);
        x *= 10;
        System.out.printf("field x on entering method useField is %d%n", x);
    }

}
